export const inboxSchema = {
    title: "站内信",

    body: [
        {
            type: "nav",
            stacked: false,
            links: [
                {
                    label: "收件箱",
                    to: "/user/msg/inbox",
                    active: true
                },
                {
                    label: "发件箱",
                    to: "/user/msg/outbox"
                }
            ]
        },
        {
            type: "wrapper",
            className: "b-l b-b b-r bg-white wrapper",
            body: {
                type: "crud",
                mode: "list",
                showHeader: false,
                title: '',
                api: "/api/user/inbox",
                noPanel: true,
                listClassName: 'no-radius',
                listItem: {
                    className: 'b-l-3x b-l-info',
                    title: "发件人：${from.name}",
                    subTitle: '日期：${publish_time}',
                    avatar: '${from.avatar|default:'+__uri('../../../static/images/img2@2x.png')+'}',
                    highlight: '<%= data.is_read == 0 ? true : "" %>',
                    desc: '${title}',
                    body: "内容：${content | n2br}",
                    actions: [
                        {
                            type: 'button',
                            icon: 'fa fa-reply',
                            tooltip: '回复',
                            actionType: 'dialog',
                            dialog: {
                                title: '回复: ${from.name}',
                                data: {
                                    title: '回复: ${from.name}',
                                    content: '> ${content}\n',
                                    to: '${from_user_id}'
                                },
                                body: {
                                    type: 'form',
                                    api: '/api/user/send',
                                    controls: [
                                        {
                                            type: 'text',
                                            name: 'title',
                                            label: '标题'
                                        },

                                        {
                                            type: 'textarea',
                                            name: 'content',
                                            label: '内容'
                                        }
                                    ]
                                }
                            }
                        },

                        {
                            type: 'button',
                            icon: 'fa fa-bell-o',
                            tooltip: '标记为已读',
                            actionType: 'ajax',
                            api: '/api/user/markread/${id}',
                            visibleOn: '!data.is_read'
                        }
                    ]
                }
            }
        }
    ]
};

export const outboxSchema = {
    title: "站内信",

    body: [
        {
            type: "nav",
            stacked: false,
            links: [
                {
                    label: "收件箱",
                    to: "/user/msg/inbox"
                },
                {
                    label: "发件箱",
                    to: "/user/msg/outbox"
                }
            ]
        },
        {
            type: "wrapper",
            className: "b-l b-b b-r bg-white wrapper",
            body: {
                type: "crud",
                title: '',
                showHeader: false,
                mode: "list",
                api: "/api/user/outbox",
                noPanel: true,
                listClassName: 'no-radius',
                listItem: {
                    className: 'b-l-3x b-l-success',
                    title: "收件人：${to.username}",
                    subTitle: '日期：${publish_time}',
                    avatar: '${from.avatar|default:'+__uri('../../../static/images/img2@2x.png')+'}',
                    desc: '${title|default:}',
                    body: "内容：${content | n2br}",
                }
            }
        }
    ]
};
